﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Chapter14.Code07.Code01
{
    using System.Timers;

    public class Demo
    {
        public static void Begin()
        {
            {
                Timer myTimer = new Timer(100);
                myTimer.Elapsed += new ElapsedEventHandler(WriteChar);
            }
            {
                Timer myTimer = new Timer(100);
                myTimer.Elapsed += WriteChar;
            }
            {
                Timer myTimer = new Timer(100);
                myTimer.Elapsed +=
                    delegate(object sender, ElapsedEventArgs e)
                    {
                        Console.WriteLine("Event handler called after {0} milliseconds.", (sender as Timer).Interval);
                    };
            }
        }

        private static void WriteChar(object sender, ElapsedEventArgs e)
        {
            throw new NotImplementedException();
        }
    }
}
